home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _0032E6411DA94D799D5C68C1ABADF036 < prev    next >
Encoding:
Text File  |  2004-01-06  |  22.3 KB  |  818 lines

  1. --#Script.ReloadScript("SCRIPTS/Default/Entities/Vehicles/Zodiac.lua")
  2.     Zodiac = {
  3. --    type = "Vehicle",
  4.     IsBoat = 1,
  5.  
  6.     bNoImpuls=1,
  7.  
  8.     --model to be used for destroyed vehicle
  9.     fileModelDead = "objects/Vehicles/zodiacraft/zodiacraft_wreck.cgf",
  10.     fPartUpdateTime=0,
  11.     curPathStep = 0,
  12.  
  13.     --entering fake_jump/blending staff
  14.     entVel = 9,
  15.     
  16.     userCounter = 0,
  17.     driverWaiting = 0,
  18.     driverDelay = 0,
  19.     passengerLimit = 0,
  20.  
  21.     
  22.     onPath = 0,
  23.     
  24.     -- previous state on the client before entering the vehicle
  25.     bDriverInTheVehicle = 0,
  26.     -- previous driver on the client before leaving the vehicle
  27.     pPreviousDriver=nil,
  28.     -- previous passenger state on the client before entering the vehicle
  29.     bPassengerInTheVehicle = 0,
  30.     -- previous passenger on the client before leaving the vehicle
  31.     pPreviousPassenger=nil,
  32.  
  33.     IsPhisicalized = 0,    
  34.  
  35. ----------------------------end---------------------------------------
  36.  
  37.     -- particle system to display when the vehicle is damaged stage 1
  38.     Damage1Effect = "smoke.vehicle_damage1.a",
  39.     -- particle system to display when the vehicle is damaged stage 2
  40.     Damage2Effect = "smoke.vehicle_damage2.a",
  41.     -- particle system to display when the vehicle explodes
  42.     ExplosionEffect = "explosions.4WD_explosion.a",
  43.     -- particle system to display when the vehicle is destroyed
  44.     DeadEffect = "fire.burning_after_explosion.a",
  45.     -- material to be used when vehicle is destroyed
  46.     DeadMaterial = "Vehicles.Zodiacraft_Screwed",
  47.  
  48.  
  49.  
  50.  
  51.     szNormalModel="objects/Vehicles/zodiacraft/zodiacraft.cgf",
  52.  
  53.     PropertiesInstance = {
  54.         sightrange = 180,
  55.         soundrange = 10,    -- rememeber that sound ranges intersect and sound range for AI doubles when in alert
  56.         aibehavior_behaviour = "Boat_idle",        
  57.         groupid = 154,
  58.     },
  59.  
  60.  
  61.     Properties = {        
  62.     
  63.         bActive = 1,    -- if vehicle is initially active or needs to be activated 
  64.                 -- with Event_Activate first
  65.         bTrackable=1,
  66.         fileName = "objects/Vehicles/zodiacraft/zodiacraft.cgf",            
  67.         
  68.         -- [kirill] vehicle gets different damage depending on who's shooter
  69.         -- defines the intensity of the damage caused by the weapons to
  70.         -- the vehicle
  71.         -- shooter is player
  72.         fDmgScaleExplosion = 1.0,        -- explosions
  73.         fDmgScaleBullet = 1.0,            -- shooting
  74.         -- shooter is AI
  75.         fDmgScaleAIExplosion = 0.7,        -- explosions
  76.         fDmgScaleAIBullet = 0.7,            -- shooting
  77.  
  78.         fAISoundRadius = 30,
  79.         
  80.         bUserPassanger = 0,
  81.         bDrawDriver = 0,
  82.         damping = 0.1,
  83.         water_damping = 1.5,
  84.         water_resistance = 0,
  85.         fLimitLRAngles = 150,
  86.         fLimitUDMinAngles = -45,
  87.         fLimitUDMaxAngles = 40,
  88.  
  89.  
  90.         ExplosionParams = {
  91.             nDamage = 800,
  92.             fRadiusMin = 5.0,
  93.             fRadiusMax = 10, -- default 25.5
  94.             fRadius = 10,    -- default 17 
  95.             fImpulsivePressure = 350,
  96.         },
  97.         
  98. -- those are AI related properties
  99.         pointReinforce = "Drop",
  100.         pointBackOff = "Base",
  101.         aggression = 1.0,
  102.         commrange = 100.0,
  103.         cohesion = 5,
  104.         attackrange = 70,
  105.         horizontal_fov = 160,
  106.         vertical_fov =90,
  107.         eye_height = 2.1,
  108.         max_health = 70,
  109.         accuracy = 0.6,
  110.         responsiveness = 7,
  111.         species = 1,
  112.         fSpeciesHostility = 2,
  113.         fGroupHostility = 0,
  114.         fPersistence = 0,
  115.         aicharacter_character = "BoatZodiac",
  116.         bodypos = 0,
  117.         pathname = "none",
  118.         pathsteps = 0,
  119.         pathstart = 0,
  120.         ReinforcePoint = "none",
  121.  
  122.         forward_speed = 1,    -- don't scale down fwd impuls - max speed
  123.         
  124.     },
  125.  
  126. --    b_speedv = 400,  -- controls Zodiac speed (movement impulse)
  127. --    b_turn = 20,  -- controls how fast Zodiac turns (turning impulse)
  128. --    fMass = 400,
  129.  
  130. --        Dumprot         = 2500,
  131. --        Dumpv        = 300,
  132. --        Dumpv        = 1000,
  133. --        Turn        = 6000,
  134. --        Speedv        = 8000,
  135.  
  136. ---------------------------- HERE
  137.     boat_params={
  138.         Damprot         = 1000,    --turning damp
  139.         Dampv        = 300,    --movement damp
  140.         Dampvs        = 500,    --movement damp
  141.         Dampvh        = 8000,    --
  142. --        Dampw        = 1400,    --waves damp
  143.         Dampw        = .22,    --waves damp        
  144.         Turn        = 400,
  145.         TurnMin        = 700,    --7000
  146.         TurnVelScale    = 10,        
  147.         
  148.         Speedv        = 5000,    -- 5500,
  149.         
  150.         Speedturnmin    = .2,
  151.         WaveM        = 300,    --fake waves momentum
  152.         Stand        = 8000,    -- forsing to normal vertical position impuls
  153.         TiltTurn    = 100,    --tilt momentum when turning
  154.         TiltSpd        = 80,    --tilt momentum when speeding up
  155.         TiltSpdA    = 0.06,    --tilt momentum when speeding up (acceleration thrhld)
  156.         TiltSpdMinV    = 10.0,    --tilt momentum when speeding up (min speed to tilt when not accelerating)
  157.         TiltSpdMinVTilt    = 0.37,    --tilt momentum when speeding up (how much to tilt when not accelerating)
  158.         fMass         = 400,
  159.         Flying        = 0,
  160.  
  161.         CameraDist    = 6,
  162.  
  163. --        Dumprot         = 2500,    --turning damp
  164. --        Dumpv        = 300,    --movement damp
  165. --        Dumpvs        = 500,    --movement damp        
  166. --        Dumpvh        = 8000,    --
  167. --        Dumpw        = 5000,    --waves damp
  168. --        Turn        = 3000,
  169. --        Speedv        = 5000,
  170. --        Speedturnmin    = .2,
  171. --        WaveM        = 500,    --fake waves momentum
  172. --        Stand        = 10000,    -- forsing to normal vertical position impuls
  173. --        TiltTurn    = 300,    --tilt momentum when turning
  174. --        TiltSpd        = 530,    --tilt momentum when speeding up
  175. --        fMass         = 400,
  176. --        Flying        = 0,
  177.  
  178.  
  179.  
  180.  
  181. --        Dumprot         = 2500,    --turning damp
  182. --        Dumpv        = 300,    --movement damp
  183. --        Dumpvh        = 10000,    --
  184. --        Dumpw        = 2000,    --waves damp
  185. --        Turn        = 8000,
  186. --        Speedv        = 5000,
  187. --        Speedturnmin    = 2,
  188. --        WaveM        = 500,    --fake waves momentum
  189. --        Stand        = 10000,    -- forsing to normal vertical position impuls
  190. --        TiltTurn    = 30,    --tilt momentum when turning
  191. --        fMass         = 400,
  192. --        Flying        = 0,
  193.     },
  194.  
  195.     boat_paramsAI={
  196.         Damprot         = 2500,    --turning dump
  197.         Dampv        = 300,    --movement dump
  198.         Dampvs        = 300,    --movement dump
  199.         Dampvh        = 10000,    --
  200. --        Dampw        = 200,    --waves dump
  201.         Dampw        = .09,    --waves damp                
  202.         Turn        = 1000,
  203.         TurnMin        = 1000,    --7000
  204.         TurnVelScale    = 10,
  205.         Speedv        = 10000,
  206.         Speedturnmin    = 0.5,
  207.         WaveM        = 500,    --fake waves momentum
  208.         Stand        = 10000,    -- forsing to normal vertical position impuls
  209.         TiltTurn    = 30,    --tilt momentum when turning
  210.         TiltSpd        = 100,    --tilt momentum when speeding up        
  211.         TiltSpdA    = 0.06,    --tilt momentum when speeding up (acceleration thrhld)
  212.         TiltSpdMinV    = 10.0,    --tilt momentum when speeding up (min speed to tilt when not accelerating)
  213.         TiltSpdMinVTilt    = 0.37,    --tilt momentum when speeding up (how much to tilt when not accelerating)
  214.         fMass         = 400,
  215.         Flying        = 0,
  216.         
  217.     },
  218.  
  219.  
  220.     
  221.     sound_time = 0,
  222.     partDmg_time = 0,    
  223.     
  224.  
  225. --// particles definitions
  226. --////////////////////////////////////////////////////////////////////////////////////////
  227.  
  228.     WaterParticle = {--boat engines affecting the water (splashes behind the boat)
  229.         focus = 20,
  230.         speed = 2.0,
  231.         count = 7,
  232.         size = 1.8, 
  233.         size_speed=0.01,
  234.         gravity={x=0,y=0,z=-3.4},
  235.         rotation={x=1,y=1,z=2},
  236.         lifetime= 1.2,
  237.         tid = System:LoadTexture("textures\\water_splash"),
  238.         start_color = {1,1,1},
  239.         end_color = {1,1,1},
  240.         blend_type = 0,
  241.         frames=0,
  242.         draw_last=1,
  243.             },
  244.  
  245.     WaterFogTrail=  {
  246.                 focus = 50,
  247.                 start_color = {1,1,1},
  248.                 end_color = {1,1,1}, 
  249.                 gravity = {x = 0.0,y = 0.0,z = -6.5}, --default z = -6.5
  250.                 rotation = {x = 0.0, y = 0.0, z = 2},
  251.                 speed = 12, -- default 12
  252.                 count = 6,
  253.                 size = 1, 
  254.                 size_speed=2.50, --default = 15
  255.                 lifetime= 1.0, --default = 3.5
  256.                 tid = System:LoadTexture("textures\\dirt2"),---clouda2.dds
  257.                 frames=1,
  258.                 blend_type = 0
  259.             },
  260.     WaterSplashes=
  261.             { --boat engines affecting the water (trail thats left behind the boat)
  262.                 focus = 60.0,
  263.                 start_color = {1,1,1},
  264.                 end_color = {1,1,1},
  265.                 gravity = {x = 0.0,y = 0.0,z = 0.0},
  266.                 rotation = {x = 0.0, y = 0.0, z = 0.5},
  267.                 speed = 2,
  268.                 count = 2,
  269.                 size = 5.0,
  270.                 size_speed=20,
  271.                 lifetime= 9.0,
  272.                 tid = System:LoadTexture("textures\\water_splash"),
  273.                 frames=1,
  274.                 blend_type = 0,
  275.                 particle_type=1
  276.             },
  277.  
  278.     PropellerWake=
  279.             { --PropellerWake
  280.                 focus = 20.0,
  281.                 start_color = {1,1,1},
  282.                 end_color = {1,1,1},
  283.                 gravity = {x = 0.0,y = 0.0,z = 0.0}, 
  284.                 rotation = {x = 0.0, y = 0.0, z = 0.1}, 
  285.                 speed = 6,
  286.                 count = 2,
  287.                 size = 4.0,
  288.                 size_speed=4.0,
  289.                 lifetime= 6.0,
  290.                 tid = System:LoadTexture("textures\\water_splash"),
  291.                 frames=1,
  292.                 blend_type = 0,
  293.                 particle_type=1
  294.             },
  295.  
  296.     
  297.     bExploded=false,
  298.  
  299.     -- engine health, status of the vehicle
  300.     -- default is set to maximum (1.0f)
  301.     fEngineHealth = 100.0,
  302.  
  303.     -- damage inflicted to the vehicle when it collides
  304.     fOnCollideDamage=0,
  305.     -- damage inflicted to the vehicle when it collides with terrain (falls off)
  306.     fOnCollideGroundDamage=0,
  307.  
  308.     bGroundVehicle=0,
  309.  
  310.     driverT = {
  311.         type = PVS_DRIVER,
  312.     
  313.         helper = "driver",
  314.         in_helper = "driver_sit_pos",
  315.         sit_anim = "inflatable_driver_sit",
  316.         anchor = AIAnchor.AIANCHOR_BOATENTER_SPOT,
  317.         out_ang = -90,
  318.         message = "@driverzodiac",
  319.         timePast=0,
  320.         HS=0,    -- used for fake jump arch calculatio - arch scale
  321.         HK=0,    -- used for fake jump arch calculatio
  322.         HO=0,    -- used for fake jump arch calculatio    
  323.         HT=0,    -- used for fake jump arch calculatio
  324.         
  325.         animations = {
  326.             "inflatable_driver_sit",        -- idle in animation
  327.             "inflatable_driver_moving",        -- driving firward
  328.             "inflatable_driver_forward_hit",    -- impact / break
  329.             "inflatable_driver_leftturn",    -- turning left
  330.             "inflatable_driver_rightturn",    -- turning right
  331.             "inflatable_driver_reverse",    -- reversing
  332.             "inflatable_driver_reverse_hit",    -- reversing impact / break
  333.         },
  334.     },
  335.  
  336.     passengersTT = {
  337.         {
  338.         type = PVS_PASSENGER,
  339.         
  340.         helper = "psngr_sit_pos01",
  341.         in_helper = "psngr_sit_pos01",
  342. --        helper = "driver",
  343. --        in_helper = "driver",
  344.         sit_anim = "vzsittingd",
  345.         anchor = AIAnchor.AIANCHOR_BOATENTER_SPOT,
  346.         out_ang = -90,
  347.         message = "@passengerzodiac",
  348.         timePast=0,
  349.         HS=0,    -- used for fake jump arch calculatio - arch scale
  350.         HK=0,    -- used for fake jump arch calculatio
  351.         HO=0,    -- used for fake jump arch calculatio    
  352.         HT=0,    -- used for fake jump arch calculatio
  353.         },
  354.     },
  355.  
  356. VC.CreateVehicle(Zodiac);
  357.  
  358. --////////////////////////////////////////////////////////////////////////////////////////
  359. function Zodiac:OnReset()
  360.     VC.OnResetCommon(self);
  361.  
  362.     self:NetPresent(1);
  363.  
  364.     VC.EveryoneOutForce(self);
  365.  
  366.     self.onPath = 0;
  367.  
  368.     self.fEngineHealth = 100.0;
  369.     
  370.     self.bExploded=false;
  371.     self.cnt:SetVehicleEngineHealth(self.fEngineHealth);
  372.  
  373.     self.fPartUpdateTime = 0;
  374.     --AI stuff
  375.     AI:RegisterWithAI(self.id, AIOBJECT_BOAT,self.Properties,self.PropertiesInstance);
  376. --    self:RegisterWithAI(AIOBJECT_BOAT,self.Properties);    
  377. --    AI_HandlersDefault:InitCharacter( self );
  378.     VC.AIDriver( self, 0 );    
  379.     
  380.     -- Put physics asleep.
  381.     self:AwakePhysics(0);
  382. end
  383.  
  384. --////////////////////////////////////////////////////////////////////////////////////////
  385. --////////////////////////////////////////////////////////////////////////////////////////
  386. --// CLIENT functions definitions
  387. --////////////////////////////////////////////////////////////////////////////////////////
  388. --////////////////////////////////////////////////////////////////////////////////////////
  389. Zodiac.Client = {
  390.     OnInit = function(self)
  391.         self:InitClient();
  392.     end,
  393.     OnShutDown = function(self)
  394.         self:OnShutDown();
  395.     end,
  396.     
  397.     Alive = {
  398.         OnBeginState = function( self )    
  399.             VC.InitBoatCommon(self);
  400.         end,
  401.         OnContact = function(self,player)
  402.              self:OnContactClient(player);
  403.         end,
  404.         OnUpdate = function(self,dt)
  405.              self:UpdateClientAlive(dt);
  406.         end,
  407.         OnCollide = VC.OnCollideClient,
  408.         OnBind = VC.OnBind,
  409.         OnUnBind = VC.OnUnBind,
  410.     },
  411.     Inactive = {
  412.         OnBeginState = function( self )
  413.             self:Hide(1);
  414.         end,
  415.         OnEndState = function( self )
  416.             self.IsPhisicalized = 0;
  417.         end,
  418.     },
  419.     Dead = {
  420.         OnBeginState = function( self )
  421.             VC.BlowUpClient(self);
  422.         end,
  423.         OnContact = function(self,player)
  424.              self:OnContactClient(player);
  425.         end,
  426.         OnUpdate = VC.UpdateClientDead,
  427.         OnCollide = VC.OnCollideClient,
  428.         OnUnBind = VC.OnUnBind,
  429.     },
  430. }
  431.  
  432. --////////////////////////////////////////////////////////////////////////////////////////
  433. function Zodiac:InitClient()
  434.     VC.InitSeats(self, Zodiac);
  435.  
  436.     --// load sounds on client only 
  437.     --////////////////////////////////////////////////////////////////////////////////////////
  438.     
  439.     self.ExplosionSound=Sound:Load3DSound("sounds\\weapons\\explosions\\mbarrel.wav",0,0,7,100000);
  440.  
  441.     self.drive_sound = Sound:Load3DSound("sounds\\vehicle\\boat\\zod_idle.wav",0,255,30,150);
  442.     self.drive_sound_move = Sound:Load3DSound("sounds\\vehicle\\boat\\splashLP.wav",0,200,30,150);
  443.  
  444.     self.accelerate_sound = {
  445.         Sound:Load3DSound("sounds\\vehicle\\rev1.wav",0,0,7,100000),
  446.         Sound:Load3DSound("sounds\\vehicle\\rev2.wav",0,0,7,100000),
  447.         Sound:Load3DSound("sounds\\vehicle\\rev3.wav",0,0,7,100000),
  448.         Sound:Load3DSound("sounds\\vehicle\\rev4.wav",0,0,7,100000),
  449.     };
  450.  
  451.     self.break_sound = Sound:Load3DSound("sounds\\vehicle\\break1.wav",0,0,7,100000);
  452.     self.engine_start = Sound:Load3DSound("sounds\\vehicle\\boat\\zod_start.wav",0,255,30,150);
  453.     self.engine_off = Sound:Load3DSound("sounds\\vehicle\\boat\\zod_off.wav",0,255,30,150);
  454.     self.sliding_sound = Sound:Load3DSound("sounds\\vehicle\\break2.wav",0,0,7,100000);
  455.  
  456.     self.crash_sound = Sound:Load3DSound("sounds\\vehicle\\boat\\rubber.wav",0,100,7,100000);
  457.  
  458.     -- init common stuff for client and server
  459.     VC.InitBoatCommon(self,self.szNormalModel);
  460.  
  461. end
  462.  
  463. --////////////////////////////////////////////////////////////////////////////////////////
  464. function Zodiac:UpdateClientAlive(dt)
  465.  
  466.     if(self.lifeCounter < 100) then
  467.         self.lifeCounter = self.lifeCounter + 1;
  468.     end    
  469.  
  470.     VC.CreateWaterParticles(self);
  471.     -- create particles and all that 
  472.     VC.ExecuteDamageModel(self, dt);
  473.  
  474.     VC.PlayEngineOnOffSounds(self);
  475.  
  476.     -- plays the sounds, using a timestep of 0.04         
  477.  
  478.     self.sound_time = self.sound_time + dt;
  479.     if ( self.sound_time > 0.04 ) then        
  480.         
  481.         -- reset timer
  482.         self.sound_time = 0;
  483.  
  484.         -- get vehicle's velocity
  485.         local fCarSpeed = self.cnt:GetVehicleVelocity();
  486.         
  487.         VC.PlayDrivingSounds(self,fCarSpeed);
  488.  
  489.     end
  490.     
  491.     VC.UpdateUsersAnimations(self,dt);
  492. end
  493.  
  494. --////////////////////////////////////////////////////////////////////////////////////////
  495. function Zodiac:OnContactClient( player )
  496.  
  497.     if( player==_localplayer and self.Properties.bUsable==0 ) then return end    
  498.     VC.OnContactClientT(self,player);
  499. end
  500.  
  501.  
  502.  
  503. --////////////////////////////////////////////////////////////////////////////////////////
  504. --////////////////////////////////////////////////////////////////////////////////////////
  505. --// SERVER functions definitions
  506. --////////////////////////////////////////////////////////////////////////////////////////
  507. --////////////////////////////////////////////////////////////////////////////////////////
  508. Zodiac.Server = {
  509.     OnInit = function(self)
  510.         self:InitServer();
  511.     end,
  512.     OnEvent = function (self, id, params)
  513.         self:OnEventServer( id, params);
  514.     end,
  515.     OnShutDown = function(self)
  516.         self:OnShutDown();
  517.     end,
  518.     Alive = {
  519.         OnBeginState = function( self )    
  520.             VC.InitBoatCommon(self);
  521.         end,
  522.         OnContact = function(self,player)
  523.              self:OnContactServer(player);
  524.         end,
  525.         OnDamage = VC.OnDamageServer,
  526.         OnCollide = VC.OnCollideServer,
  527.         OnUpdate = function(self,dt)
  528.             self:UpdateServer(dt);
  529.         end,
  530.         
  531.     },
  532.     Inactive = {
  533.     },
  534.     Dead = {
  535.         OnBeginState = function( self )
  536.             VC.BlowUpServer(self);
  537.         end,
  538.         OnContact = function(self,player)
  539.              VC.OnContactClientDead(self,player);
  540.         end,            
  541.     },
  542. }
  543.  
  544. --////////////////////////////////////////////////////////////////////////////////////////
  545. function Zodiac:InitServer()
  546.     VC.InitSeats(self, Zodiac);
  547.     
  548.     -- init common stuff for client and server
  549.     VC.InitBoatCommon(self,self.szNormalModel);
  550.  
  551.     self:OnReset();
  552. end
  553.  
  554. -- called on the server when the player collides with the Zodiac
  555. --////////////////////////////////////////////////////////////////////////////////////////
  556. function Zodiac:OnContactServer( player )
  557.  
  558.     if( self.Properties.bUsable==0 ) then return end
  559.     VC.OnContactServerT(self,player);
  560. end
  561.  
  562.  
  563. --////////////////////////////////////////////////////////////////////////////////////////
  564. function Zodiac:UpdateServer(dt)
  565.  
  566.  
  567. --System:Log("\004 Zodiac:UpdateServer");▀
  568.     if( self.Properties.bUserPassanger == 1 ) then
  569.         if( self.driver == nil ) then
  570.             AI:Signal(SIGNALFILTER_GROUPONLY, 1, "wakeup", self.id);            
  571.             AI:Signal(SIGNALFILTER_GROUPONLY, 1, "SHARED_ENTER_ME_VEHICLE", self.id);
  572.         elseif(self.passenger ~= nil) then
  573.             self:StartPath();
  574.         end
  575.     end
  576.  
  577.     VC.UpdateEnteringLeaving( self, dt );
  578.     VC.UpdateServerCommonT( self, dt );
  579.  
  580. end
  581.  
  582.  
  583. --////////////////////////////////////////////////////////////////////////////////////////
  584. function Zodiac:OnEventServer( id, params)
  585.  
  586.     if (id == ScriptEvent_PhysicalizeOnDemand) then
  587.         self:SetPhysicParams( PHYSICPARAM_FLAGS, {flags_mask=pef_pushable_by_players, flags=0} );
  588.     end
  589.     
  590. end
  591.  
  592. --////////////////////////////////////////////////////////////////////////////////////////
  593. function Zodiac:OnShutDown()
  594.     VC.EveryoneOutForce(self);
  595.     VC.RemovePieces(self);    
  596. end
  597.  
  598.  
  599.  
  600. --////////////////////////////////////////////////////////////////////////////////////////
  601. function Zodiac:OnSave(stm)
  602. end
  603.  
  604. --////////////////////////////////////////////////////////////////////////////////////////
  605. function Zodiac:OnLoad(stm)
  606. end
  607.  
  608.  
  609. --////////////////////////////////////////////////////////////////////////////////////////
  610. function Zodiac:OnWrite( stm )
  611.     
  612. end
  613.  
  614. --////////////////////////////////////////////////////////////////////////////////////////
  615. function Zodiac:OnRead( stm )
  616.  
  617. end
  618.  
  619. --////////////////////////////////////////////////////////////////////////////////////////
  620.  
  621.  
  622. ----------------------------------------------------------------------------------------------------------------------------
  623. --
  624. --
  625. function Zodiac:RadioChatter()
  626. end
  627.  
  628.  
  629. ----------------------------------------------------------------------------------------------------------------------------
  630. --
  631. --
  632. --function Zodiac:LoadPeople()
  633. --
  634. ----    self:AIDriver( 1 );
  635. --    
  636. --    AI:Signal(SIGNALFILTER_GROUPONLY, 1, "SHARED_ENTER_ME_VEHICLE", self.id);
  637. --    self.dropState = 1;
  638. --    
  639. --end
  640.  
  641. ----------------------------------------------------------------------------------------------------------------------------
  642. --
  643. -- to test
  644. function Zodiac:StartPath(  )
  645.  
  646. --System:Log("\001 starting path");
  647.  
  648.     if( self.onPath == 1 ) then return end
  649.  
  650.     if(self.driver and self.passenger) then
  651.         self.onPath = 1;
  652.         
  653.         self:Event_GoPath( );
  654. --        BroadcastEvent( self,"StartAniPath" );
  655.     end    
  656. end
  657.  
  658. ----------------------------------------------------------------------------------------------------------------------------
  659. --
  660. -- to test
  661. function Zodiac:Event_StartAniPath( params )
  662.  
  663. System:LogToConsole("-----    got Event_StartAniPath -----");
  664.  
  665. end
  666.  
  667.  
  668.  
  669. ----------------------------------------------------------------------------------------------------------------------------
  670. --
  671. function Zodiac:Event_GoPath( params )
  672.  
  673. --System:Log("\001  Humvee GoPath  ");
  674.  
  675.     self.curPathStep = self.Properties.pathstart-1;
  676.     VC.AIDriver( self, 1 );    
  677.     AI:Signal(0, 1, "GO_PATH", self.id);
  678.  
  679. end
  680.  
  681.  
  682. ----------------------------------------------------------------------------------------------------------------------------
  683. --
  684.  
  685.  
  686. -------------------------------------------------------------------------------------------------------------
  687. --
  688. --
  689. function Zodiac:DoEnter( puppet )
  690.  
  691.     if( puppet == self.driverT.entity ) then        -- driver
  692.         VC.AddUserT( self, self.driverT );
  693.         VC.InitEnteringJump( self, self.driverT );
  694. --    end
  695.     else                            -- passengers
  696.         local tbl = VC.FindPassenger( self, puppet );
  697.         if( not tbl ) then return end
  698.         VC.AddUserT( self, tbl );
  699.         VC.InitEnteringJump( self, tbl );
  700.     end
  701.     
  702. end
  703.  
  704.  
  705. -------------------------------------------------------------------------------------------------------------
  706. --
  707. --
  708. function Zodiac:AddDriver( puppet )
  709.  
  710.     if (self.driverT.entity ~= nil)        then    -- already have a driver
  711.         do return 0 end
  712.     end
  713.     
  714.     self.driverT.entity = puppet;
  715.     if( VC.InitApproach( self, self.driverT )==0 ) then    
  716.         self:DoEnter( puppet );
  717.     end    
  718.     do return 1 end    
  719. --    return VC.AddDriver( self, puppet);
  720. end
  721.  
  722. -------------------------------------------------------------------------------------------------------------
  723. --
  724. --
  725. function Zodiac:AddGunner( puppet )
  726.     return 0        -- no gunner
  727. --    return VC.AddDGunner( self, puppet);
  728. end
  729.  
  730. ----------------------------------------------------------------------------------------------------------------------------
  731. --
  732. function Zodiac:AddPassenger( puppet )
  733.  
  734.     do return 0    end    -- no passanger for now
  735.  
  736.     local pasTbl = VC.CanAddPassenger( self, 1 );
  737.  
  738.     if( not pasTbl ) then    return 0 end    -- no more passangers can be added
  739.     
  740.     pasTbl.entity = puppet;
  741.     if( VC.InitApproach( self, pasTbl )==0 ) then
  742.         self:DoEnter( puppet );
  743.     end
  744.     do return 1 end    
  745. end
  746.  
  747.  
  748. ----------------------------------------------------------------------------------------------------------------------------
  749. --
  750. --
  751. function Zodiac:LoadPeople()
  752.  
  753.     if(VC.FreeToUse( self )==0) then return end    -- can't use it - player is in
  754.  
  755.     if(self.driverT.entity and self.driverT.entity.ai) then
  756. System:Log("boat LoadPeople  +++++ DRIVER IS IN ");
  757.         
  758.         AI:Signal(0, 1, "DRIVER_IN", self.id);
  759.     end    
  760.     
  761.     AI:Signal(SIGNALFILTER_GROUPONLY, 1, "wakeup", self.id);
  762.     AI:Signal(SIGNALFILTER_GROUPONLY, 1, "SHARED_ENTER_ME_VEHICLE", self.id);
  763.     self.dropState = 1;
  764. end
  765.  
  766.  
  767.  
  768. ----------------------------------------------------------------------------------------------------------------------------
  769. --
  770.  
  771. function Zodiac:Event_AddPlayer( params )
  772.  
  773.     if(_localplayer.theVehicle) then return end    -- this player is already in some (this) vehicle
  774.     
  775.     local theTable = VC.GetAvailablePosition(self);
  776.     
  777.     if(theTable == nil) then return end
  778.  
  779.     _localplayer.cnt.use_pressed = nil;
  780.     theTable.entity = _localplayer;
  781.     VC.AddUserT(self, theTable);    
  782.     
  783.  
  784.     
  785. end    
  786.  
  787. ----------------------------------------------------------------------------------------------------------------------------
  788. --
  789. function Zodiac:Event_DriverIn( params )
  790.  
  791.     BroadcastEvent( self,"DriverIn" );
  792.     
  793. end    
  794.  
  795.  
  796. -----------------------------------------------------------------------------------------------------
  797. --
  798. --
  799. function Zodiac:Event_Activate( params )
  800.  
  801.     if(self.bExploded == 1) then return end
  802.     
  803.     self:GotoState( "Alive" );
  804. end
  805.  
  806. ----------------------------------------------------------------------------------------------------------------------------
  807. --
  808. --
  809.  
  810. --------------------------------------------------------------------------------------------------------
  811. -- empty function to get reed of script error - it's called from behavours
  812. function Zodiac:MakeAlerted()
  813. end
  814.  
  815.  
  816. --------------------------------------------------------------------------------------------------------------
  817.